<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

</head>

<body>

<!-- 三角形-->

<script>

for (var a=1;a<=5;a++){ 

for (var b=1;b<=5-a;b++){ 

document.write(" ") 
}

for (var c=1;c<=a;c++){

document.write("*  ") 

}

document.write("<br>") //document.write()可以在页面输出字符串，换行

}

</script>

<script>/* 平行四边形 */

for (var a=1;a<=5;a++) { 

for (c=a; c <=5; c++) { 
document.write(" ");

}

for (b = 1; b<=5; b++) {

document.write(" "+"*")

}

document.write("<br>") 
}

</script>

<script>/* 菱形 */

for(var i=1;i<=3;i++){ 

for(var j=1;j<=3-i;j++){ 
document.write("  ");

}

for(var k=1;k<=2*i-1;k++){

document.write("* "); 

}

document.write("<br/>");

}

for( i=1;i<=2;i++){

for(j=1;j<=i;j++){

document.write("  ");

}

for(k=1;k<=5-2*i;k++){

document.write("* ");

}

document.write("<br/>");

}

</script>

</body>

</html>
